package com.cy.pj.goods.service;

import com.cy.pj.goods.dao.GoodsDao;
import com.cy.pj.goods.pojo.Goods;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.List;


@Component
public class GoodsServicelmpl implements GoodsService{
    @Autowired
    private GoodsDao goodsDao;
    private static final Logger log =
           LoggerFactory.getLogger(GoodsServicelmpl.class);
    @Override
    public List<Goods> findGoods() throws IOException {
        long f1 = System.currentTimeMillis();
        List<Goods> list = goodsDao.findGoods();
        long f2 = System.currentTimeMillis();
        log.info("execut time {}",f2-f1);
        return list;
    }

    @Override
    public int deleteById(Integer id) {
        long f3 = System.currentTimeMillis();
        int a = goodsDao.deleteById(id);
        long f4 = System.currentTimeMillis();
        log.info("execut delete time {}", f4-f3);
        return a;
    }
}
